package com.soboot.datasource.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.soboot.base.enums.DeleteStatus;
import com.soboot.base.model.BaseExtEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.Date;

/**
 * @Author:
 * @createTime: 2022年09月20日 17:06:27
 * @version: 1.0
 * @Description: 抽象实体基类
 * @Copyright:
 */
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity extends BaseExtEntity {

    @Builder.Default
    @TableField(value = "deleted", fill = FieldFill.INSERT)
    private String deleted = DeleteStatus.NOT_DELETE.getValue();

    @Builder.Default
    @TableField(value = "status", fill = FieldFill.INSERT)
    private String status = DeleteStatus.DELETE.getValue();

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private String createBy;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
    private String updateBy;
}
